package com.example.controller;



import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.common.model.CommonResult;
import com.example.entity.dto.BaseDTO;
import com.example.entity.dto.MaskingRuleAddDto;
import com.example.entity.dto.MaskingRuleEditDto;
import com.example.entity.vo.MaskingRuleVo;
import com.example.service.IMaskingRuleService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author xuhang
 * @desc
 * @date 2025-05-06
 */

@RestController
@RequestMapping("/maskingRule")
public class MaskingRuleController  {

    @Resource
    private IMaskingRuleService maskingRuleService;

    @PostMapping("/page")
    public CommonResult<Page<MaskingRuleVo>> page(@RequestBody BaseDTO pageDto) {
        return CommonResult.success(maskingRuleService.selectPage(pageDto));
    }

    @PostMapping("/add")
    public CommonResult<Boolean> add(@RequestBody MaskingRuleAddDto addDto) {
        return CommonResult.success(maskingRuleService.add(addDto));
    }

    @PostMapping("/update")
    public CommonResult<Boolean> edit(@RequestBody MaskingRuleEditDto editDto) {
        return CommonResult.success(maskingRuleService.edit(editDto));
    }

    @GetMapping("/delete")
    public CommonResult<Boolean> delete(@RequestParam Integer id) {
        return CommonResult.success(maskingRuleService.delete(id));
    }
}
